
/*
 * AIInspector.m
 *
 * AIInspector is a subclass of WMInspector responsible for handling
 * the new and revert: messages from the Workspace Manager.
 *
 *
 * You may freely copy, distribute, and reuse the code in this example.
 * Both Terrence Talbot and Digital Tool Works disclaim any warranty
 * of any kind, expressed or implied, as to its fitness for any particular use.
 *
 * Written by:  Terrence Talbot 
 *    Created:  Oct/92
 *
 */

#import <appkit/appkit.h>
#import <objc/NXBundle.h>

#import "AIInspector.h"
#import "AIView.h"

@implementation AIInspector

static id aiInspector = nil;

+ new
{
   if ( aiInspector == nil ) {
      char path[MAXPATHLEN + 1];
      NXBundle *bundle = [NXBundle bundleForClass:self];
      
      self = aiInspector = [super new];
      if ( [bundle getPath:path 
               forResource:"AIInspector"
                    ofType:"nib"] ) {
         [NXApp loadNibFile:path owner:aiInspector];
      }
      else {
         NXLogError("Couldn't load AIInspector.nib.");
         aiInspector = nil;
      }      
   }
   
   return aiInspector;
}

- revert:sender
{
   char fullPath[MAXPATHLEN + 1];
   [self selectionPathsInto:fullPath separator:'\0'];
   [myAIView setImageToFilename:fullPath];
   
   [super revert:sender];
   
   return self;
}

@end
